package com.pearl.jacksonspringboot.demo.custom;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdJdkSerializers;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.springframework.boot.jackson.JsonObjectSerializer;

import java.io.IOException;

/**
 * @author TD
 * @version 1.0
 * @date 2024/4/12
 */
public class MyJsonObjectSerializer extends StdSerializer<String> {

    public MyJsonObjectSerializer() {
        super(String.class, false);
    }
    @Override
    public void serialize(String value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
            System.out.println("MyJsonObjectSerializer=============================================");
        jsonGenerator.writeString("value");
    }
}
